﻿using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Borg.Framework
{
    public class Path
    {
        private readonly ReadOnlyCollection<Connection> _path;

        public Path(Connection connection)
            : this(connection, null)
        { }

        public Path(Connection connection, Path path)
        {
            var list = new List<Connection> { connection };

            if (path != null)
                list.AddRange(path._path);

            _path = new ReadOnlyCollection<Connection>(list);
        }

        public IList<Connection> Connections
        {
            get { return _path; }
        }

        public class Connection
        {
            private readonly PlugInfo _plug;
            private readonly SlotInfo _slot;

            public Connection(PlugInfo plug, SlotInfo slot)
            {
                _plug = plug;
                _slot = slot;
            }

            public PlugInfo Plug
            {
                get { return _plug; }
            }

            public SlotInfo Slot
            {
                get { return _slot; }
            }
        }
    }
}

